package cn.com.e2suntech.demo.action;

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cn.com.e2suntech.demo.service.IUserMgtService;

@Controller
@RequestMapping("/page")
public class MainPageController {
    private static final Logger logger = LoggerFactory.getLogger(MainPageController.class);

    @Autowired
    private IUserMgtService userMgtService;

    /**
     * Simply selects the home view to render by returning its name.
     */
    @RequestMapping(value = "/jsp", method = RequestMethod.GET)
    public String jsp(Locale locale, Model model) {
       
        Date date = new Date();
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
        String formattedDate = dateFormat.format(date);
        model.addAttribute("serverTime", formattedDate);

        return "demo/jsp";
    }

    @RequestMapping(value = "/ftl", method = RequestMethod.GET)
    public ModelAndView freemarker() {
        ModelAndView view = new ModelAndView("demo/freemarker");
        view.addObject("message", "Say hi for Freemarker.");
        return view;

    }
}
